<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>商品管理</title>

	<%-- 静态包含 base标签、css样式、jQuery文件 --%>
	<%@ include file="/pages/common/head.jsp"%>
	
	<script type="text/javascript">
		$(function () {
			// 给删除的a标签绑定单击事件，用于删除的确认提示操作
			$("a.deleteClass").click(function () {
				return confirm("你确定要删除【" + $(this).parent().parent().find("td:first").text() + "】?");
			});
		});
	</script>

</head>
<body>
	
	<div id="header">
			<img class="logo_img" alt="" src="static/img/logo.jpg" >
			<span class="wel_word">商品管理</span>

		<div>
			<a href="pages/admin/product_edit.jsp?pageNo=${requestScope.page.pageTotal}">添加商品</a>&nbsp;&nbsp;
		    <a href="admin/orderServlet?action=showOrder">订单管理</a>&nbsp;&nbsp;
		    <a href="index.jsp">返回商城</a>
		</div>

	</div>
	
	<div id="main">
		<table>
			<tr>
				<td>商品名</td>
				<td>价格</td>
				<td>库存</td>
				<td>销量</td>
				<td>商家</td>
				<td>上架时间</td>
				<td colspan="2">操作</td>
			</tr>		

			<c:forEach items="${requestScope.page.items}" var="product">
				<tr>
					<td>${product.name}</td>
					<td>${product.price}</td>
					<td>${product.counts}</td>
					<td>${product.sales}</td>
					<td>${product.productor}</td>
					<td>${product.crtTime}</td>
					<td><a href="admin/productServlet?action=getProduct&id=${product.id}&pageNo=${requestScope.page.pageNo}">修改</a></td>
					<td><a class="deleteClass" href="admin/productServlet?action=delete&id=${product.id}&pageNo=${requestScope.page.pageNo}">删除</a></td>
				</tr>
			</c:forEach>
		</table>&nbsp;&nbsp;

		<%--静态包含分页条--%>
		<%@include file="/pages/common/page_nav.jsp"%>

	</div>

	<%--静态包含页脚内容--%>
	<%@include file="/pages/common/footer.jsp"%>

</body>
</html>